package com.snail.controller;

import com.snail.common.DeleteRequest;
import com.snail.model.dto.CourseBaseDto;
import com.snail.model.dto.CourseOutlinesTreeDto;
import com.snail.model.pojo.BizCourseOutlines;
import com.snail.response.BaseResponse;
import com.snail.response.ResultUtils;
import com.snail.service.BizCourseOutlinesService;
import lombok.AllArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author Monica
 * @description
 * @date 2025/7/17 22:45
 */
@RestController
@RequestMapping("/courseOutlines")
@AllArgsConstructor
public class BizCourseOutlinesController {

    private final BizCourseOutlinesService bizCourseOutlinesService;

    @GetMapping("/getCourseOutlinesTree")
    public BaseResponse<List<CourseOutlinesTreeDto>> getCourseOutlines(Integer courseId) {
        return bizCourseOutlinesService.getCourseOutlines(courseId);
    }

    @PostMapping("/saveCourseOutlines")
    public BaseResponse<Boolean> saveCourseOutlines(@RequestBody BizCourseOutlines bizCourseOutlines) {
        return bizCourseOutlinesService.saveCourseOutlines(bizCourseOutlines);
    }

    @PostMapping("/updateCourseOutlines")
    public BaseResponse<Boolean> updateCourseOutlines(@RequestBody BizCourseOutlines bizCourseOutlines) {
        return bizCourseOutlinesService.updateCourseOutlines(bizCourseOutlines);
    }

    @PostMapping("/deleteCourseOutlines")
    public BaseResponse<Boolean> deleteCourseOutlines(@RequestBody DeleteRequest deleteRequest) {
        return bizCourseOutlinesService.deleteCourseOutlines(deleteRequest);
    }


    @GetMapping("/getCourseBaseById")
    public BaseResponse<CourseBaseDto> getCourseBaseById(Long id) {
        return bizCourseOutlinesService.getCourseBaseById(id);
    }

    @GetMapping("/getOutlineById")
    public BaseResponse<BizCourseOutlines> getOutlineById(Long id) {
        BizCourseOutlines outlinesServiceById = bizCourseOutlinesService.getById(id);
        return ResultUtils.success(outlinesServiceById);
    }
}
